{include file="../../templates/admin/header.tpl"}
<div class="span12">
	<div class="widget">
		<div class="widget-header">
			<i class="icon-th-list"></i>
			<h3>Add new game</h3>
		</div>
		<!-- /widget-header -->
		<div class="widget-content">
		{if $status}
			<div class="alert {$class}">
				<button type="button" class="close" data-dismiss="alert">&times;</button>
				<ul>{$status}</ul>
            </div>
        {/if}
			<form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
				<fieldset>
					<div class="control-group">											
						<label class="control-label" for="g_name">Name</label>
                        <div class="controls">
							<div class="input-append">
								<input type="text" class="span3 m-wrap" name="g_name" id="g_name" value="{$g_name}" required>
								<button class="btn" id="checkgame" type="button">Check</button>
							</div>
							<p class="help-block"><em>Games name. Ex: Action game; Shooting game; Skill game; Unity 3D action game</em></p>
							<div id="load"><img src="/static/img/loading-small.gif" width="16" height="11" /> Loading...</div>
							<p id="result" class="help-block"></p>
						</div>
					</div>
					<div class="control-group">											
						<label class="control-label" for="g_url">URL</label>
						<div class="controls">
							<input type="text" class="span3" name="g_url" id="g_url" value="{$g_url}">
							<p class="help-block"><em>Game Url. Ex: action-games; shooting-games; skill-games; unity-3D</em></p>
						</div>
					</div>
					<div class="control-group">											
						<label class="control-label" for="g_object">Object</label>
						<div class="controls">
							<input type="text" class="span6" name="object" id="g_object" value="{$object}" required>
							<p class="help-block"><em>Game file url. Ex: http://games.mafa.com/2/Forzen-Anna-Hair-Care.swf</em></p>
						</div>
					</div>
					<div class="control-group">											
						<label class="control-label" for="g_resolution">Games resolution</label>
						<div class="controls">
							<input type="text" class="span1" name="width" id="g_resolution" value="{$width}" required> x <input type="text" class="span1" name="height" value="{$height}" required>
							<p class="help-block"><em>Ex: 750x550 (px)</em></p>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">Category</label>
						<div class="controls">
						{foreach $categories as $key=>$value}
							<label class="checkbox inline">
								{if in_array($value['c_url'], $current_cat)}
									<input type="checkbox" name="category[]" value="{$value['c_url']}" checked="checked"> <strong>{$value['c_name']}</strong>
								{else}
									<input type="checkbox" name="category[]" value="{$value['c_url']}"> {$value['c_name']}
								{/if}
							</label>
						{/foreach}
						</div>
					</div>
					<div class="control-group">											
						<label class="control-label" for="text_tag_input">Tags</label>
						<div class="controls">
							<!--<input type="text" class="span6" name="tags" id="text_tag_input" value="{$tags}" data-role="tagsinput">-->
							<input type="text" class="span6" name="tags" id="text_tag_input" value="{$tags}">
							<div class="help-block" id="tags_select">
							{foreach $all_tags as $key=>$value}
								<label class="checkbox inline">
									<input type="checkbox" value="{$value['tag']}"> {str_replace('Games', '', $value['name'])}
								</label>
							{/foreach}
							</div>
						</div>
					</div>
					<div class="control-group">											
						<div class="controls">
							<div class="form-group">
								<input type="file" name="image_up" id="imagefile" class="file">
								<p class="help-block"><em>Image thumbnail of game. Max size: 200KB</em></p>
							</div>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="summary">Summary (160 characters)</label>
						<div class="controls">
							<div class="form-group">
								<textarea id="summary" name="summary" class="span6" rows="5" maxlength="160">{$summary}</textarea>
							</div>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="desc">Description</label>
						<div class="controls">
							<div class="form-group">
								<textarea id="desc" name="description" class="span6" rows="10">{$description}</textarea>
							</div>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="howto">How to?</label>
						<div class="controls">
							<div class="form-group">
								<textarea id="howto" name="howto" class="span6" rows="10">{$howto}</textarea>
							</div>
						</div>
					</div>
					<div class="form-actions">
						<button type="submit" name="submit" value="submit" class="btn btn-primary">Save</button> 
						<button class="btn" type="reset">Clear all</button>
					</div>
				</fieldset>
			</form>
		</div>
		<!-- /widget-content --> 
	</div>
</div>
<script type="text/javascript" src="/libs/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
	entity_encoding: "raw",
    mode: "exact",
    elements: "desc, howto",
	theme: "advanced",
    plugins: "safari,table,paste,inlinepopups,preview,fullscreen",
    dialog_type: "modal",
    theme_advanced_toolbar_location: "bottom",
    theme_advanced_toolbar_align : "left",
    theme_advanced_resizing : true,
	forced_root_block: false,
    force_br_newlines: true,
    force_p_newlines: false,
    theme_advanced_toolbar_align : "left",
    theme_advanced_buttons1: "bold,italic,underline,|,link,unlink,|,cleanup,code,preview,fullscreen,|,undo,redo,|,image,|,bullist,numlist",
    theme_advanced_buttons2: "",
    theme_advanced_buttons3: ""
});
</script>
{include file="../../templates/admin/footer.tpl"}